#ifndef INTDSP_BIQUAD_H_INCLUDED
#define INTDSP_BIQUAD_H_INCLUDED

#define BIQUAD_FRAC_BITS  10
#define BIQUAD_ONE        1024
#define BIQUAD_HALF       512

#ifndef __ASSEMBLER__

#include <stdint.h>

#ifdef __cplusplus
extern "C" {
#endif

/**
 * fixed-point parameters of a biquad filter
 * (with BIQUAD_FRAC_BITS fractional bits)
 */
struct biquad_params
{
	int16_t a1, a2, b1, b2;
};

/**
 * state of biquad filter (memory)
 */
struct biquad_state
{
	int32_t t1, t2;
};

/**
 * apply biquad filter in-place
 *
 * @param nsamples
 *   number of samples to process
 * @param samplebuff
 *   pointer to sample buffer
 * @param bqparams
 *   pointer to the biquad filter's parameter
 * @param bqstate
 *   pointer to the biquad filter's state
 */
extern void biquad_inplace(
	int nsamples,
	int32_t samplebuff[],
	const struct biquad_params *bqparams
	struct biquad_state *bqtate);

#ifdef __cplusplus
}
#endif
#endif
#endif
